#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include "SimpleScreenCaptureHandler.h"

#include <QMainWindow>
#include <osgQOpenGL/osgQOpenGLWidget>
#include <osgViewer/Viewer>
#include <osg/Node>
#include <osgDB/ReadFile>
#include <osgGA/TrackballManipulator>
#include <osgAnimation/StatsHandler>
#include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
#include <osgDB/ReadFile>
#include <osgDB/WriteFile>
#include <osgQOpenGL/osgQOpenGLWidget>
#include <osgGA/TrackballManipulator>
#include <osgUtil/Optimizer>
#include <osg/Group>
#include <osg/Node>
#include <osg/Geode>
#include <osg/Drawable>
#include <osgParticle/PrecipitationEffect>
#include <osg/MatrixTransform>
#include <osg/Camera>
#include <QHBoxLayout>
#include <QPushButton>
#include <QDebug>
#include <osg/BoundingSphere>
#include <osgGA/DriveManipulator>
#include <osgGA/GUIActionAdapter>
#include <osgGA/GUIEventAdapter>
#include <osgUtil/LineSegmentIntersector>
#include <osg/ShapeDrawable>
#include <osgGA/FlightManipulator>
#include <osgGA/DriveManipulator>
#include <osgGA/StateSetManipulator>
#include <osg/ComputeBoundsVisitor>
#include <osg/TriangleIndexFunctor>

#include <osg/Camera>
#include <osgFX/Outline>
#include <QThreadPool>

//粒子系统头文件
#include <osgParticle/Particle>
#include <osgParticle/ParticleSystemUpdater>
#include <osgParticle/ModularEmitter>
#include <osgParticle/RandomRateCounter>
#include <osgParticle/MultiSegmentPlacer>
#include <osgParticle/RadialShooter>
#include <osgParticle/FluidProgram>

//雾雨雪
#include <osg/Fog>
#include <osgParticle/FireEffect>
#include <osgParticle/ExplosionEffect>
#include <osgParticle/ExplosionDebrisEffect>
#include <osgParticle/SmokeEffect>
#include <osgParticle/SmokeTrailEffect>


//阴影
#include <osgShadow/ShadowedScene>
#include <osgShadow/SoftShadowMap>


#include <osg/Camera>
#include <osg/Texture2D>
#include <osg/FrameBufferObject>
#include <osgDB/WriteFile>

#include <osgDB/WriteFile>


#pragma execution_character_set("utf-8")
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();


    osg::ref_ptr<osg::MatrixTransform> matChange(osg::Vec3 position, osg::Vec3 pose, double scale);

    void setMatrix(osg::MatrixTransform *mat_node, double x, double y, double z);
private slots:
    void on_pushButton_clicked();


    void on_pushButton_2_clicked();
void addParticle(QString nodeFile, osg::Vec3 position, osg::Vec3 pose, double scale);
void on_pushButton_3_clicked();

void on_pushButton_4_clicked();

void on_pushButton_5_clicked();

void on_pushButton_6_clicked();

private:
    Ui::MainWindow *ui;

    osgQOpenGLWidget* osgWidget;
    QString m_fileName;
    void initOSG();
    osg::Node* node;
    osg::ref_ptr<osg::Program> program;
    void SaveOsgImage(QString filePath, osg::Camera* camera);
    SimpleScreenCaptureHandler* m_screenshotHandler = nullptr;
    osgViewer::Viewer* pViewer;
    osg::ref_ptr<osg::Group> root ;
    int currentIndex=0;
    // 在头文件中声明辅助函数
    osg::ref_ptr<osgParticle::ParticleSystem> createStaticParticleClone(osgParticle::ParticleSystem* original);

    osg::Node* node1;
    osg::Node* node2;


};
#endif // MAINWINDOW_H
